﻿Imports BPEditor

Class MainWindow
    Private Sub MainWindow_Resize() Handles Me.SizeChanged
        Editor1.Width = Width - 15
        Editor1.Height = Height - 40
        'Dim blk As shpBlock, prt As shpPort
        'blk = Editor1.AddBlock(100, 100)
        'blk.AddInput()
        'blk.Fill = Brushes.Red
        'prt = Editor1.AddActivator
        'prt.Fill = Brushes.Black
    End Sub

    Private Sub MainWindow_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles Me.KeyDown
        If e.Key = Input.Key.Add Then
            Editor1.Width *= 1.01
            Editor1.Height *= 1.01
        ElseIf e.Key = Input.Key.Subtract Then
            Editor1.Width /= 1.01
            Editor1.Height /= 1.01
        End If
    End Sub

    Private Sub ImagePanel_Drop(ByVal sender As Object, ByVal e As DragEventArgs) Handles Me.Drop
        Dim files() As String, f As String
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            files = e.Data.GetData(DataFormats.FileDrop)
            For Each f In files
                Editor1.Import(IO.File.ReadAllText(f))
            Next
        End If
    End Sub

    Private Sub shpBlock_CreatedBlock(ByVal sender As Object, ByVal control As shpBlock) Handles Editor1.CreatedBlock
        tbLog.AppendText("CreatedBlock_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_DeletedBlock(ByVal sender As Object, ByVal control As shpBlock) Handles Editor1.DeletedBlock
        tbLog.AppendText("DeletedBlock_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_CreatedActivator(ByVal sender As Object, ByVal control As clsActivator) Handles Editor1.CreatedActivator
        tbLog.AppendText("CreatedActivator_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_DeletedActivator(ByVal sender As Object, ByVal control As clsActivator) Handles Editor1.DeletedActivator
        tbLog.AppendText("DeletedActivator_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_CreatedEvent(ByVal sender As Object, ByVal control As clsEvent) Handles Editor1.CreatedEvent
        tbLog.AppendText("CreatedEvent_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_DeletedEvent(ByVal sender As Object, ByVal control As clsEvent) Handles Editor1.DeletedEvent
        tbLog.AppendText("DeletedEvent_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_CreatedInput(ByVal sender As Object, ByVal control As clsInput) Handles Editor1.CreatedInput
        tbLog.AppendText("CreatedInput_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_DeletedInput(ByVal sender As Object, ByVal control As clsInput) Handles Editor1.DeletedInput
        tbLog.AppendText("DeletedInput_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_CreatedOutput(ByVal sender As Object, ByVal control As clsOutput) Handles Editor1.CreatedOutput
        tbLog.AppendText("CreatedOutput_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_DeletedOutput(ByVal sender As Object, ByVal control As clsOutput) Handles Editor1.DeletedOutput
        tbLog.AppendText("DeletedOutput_key=" & control.Key & " ")
    End Sub

    Private Sub shpConnector_ConnectPorts(ByVal sender As Object, ByVal Port1 As shpPort, ByVal Port2 As shpPort) Handles Editor1.ConnectPorts
        tbLog.AppendText("ConnectPorts_port1=" & Port1.Key & "_port2=" & Port2.Key & " ")
    End Sub

    Private Sub shpConnector_DisconnectPorts(ByVal sender As Object, ByVal Port1 As shpPort, ByVal Port2 As shpPort) Handles Editor1.DisconnectPorts
        tbLog.AppendText("DisconnectPorts_port1=" & Port1.Key & "_port2=" & Port2.Key & " ")
    End Sub

    Private Sub shpBlock_UnloadedBlock(ByVal sender As Object, ByVal control As shpBlock) Handles Editor1.UnloadedBlock
        tbLog.AppendText("UnloadedBlock_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_UnloadedActivator(ByVal sender As Object, ByVal control As clsActivator) Handles Editor1.UnloadedActivator
        tbLog.AppendText("UnloadedActivator_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_UnloadedEvent(ByVal sender As Object, ByVal control As clsEvent) Handles Editor1.UnloadedEvent_
        tbLog.AppendText("UnloadedEvent_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_UnloadedInput(ByVal sender As Object, ByVal control As clsInput) Handles Editor1.UnloadedInput
        tbLog.AppendText("UnloadedInput_key=" & control.Key & " ")
    End Sub

    Private Sub shpBlock_UnloadedOutput(ByVal sender As Object, ByVal control As clsOutput) Handles Editor1.UnloadedOutput
        tbLog.AppendText("UnloadedOutput_key=" & control.Key & " ")
    End Sub

    Private Sub shpActivator_DoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Handles Editor1.ActivatorDoubleClick
        tbLog.AppendText("ActivatorDoubleClick_key=" & sender.Key & " ")
    End Sub

    Private Sub shpEvent_DoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Handles Editor1.EventDoubleClick
        tbLog.AppendText("EventDoubleClick_key=" & sender.Key & " ")
    End Sub

    Private Sub shpInput_DoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Handles Editor1.InputDoubleClick
        tbLog.AppendText("InputDoubleClick_key=" & sender.Key & " ")
    End Sub

    Private Sub shpOutput_DoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Handles Editor1.OutputDoubleClick
        tbLog.AppendText("OutputDoubleClick_key=" & sender.Key & " ")
    End Sub

    Private Sub shpBlock_DoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Handles Editor1.BlockDoubleClick
        tbLog.AppendText("BlockDoubleClick_key=" & sender.Key & " ")
    End Sub

    Private Sub shpEditor_DoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Handles Editor1.EditorDoubleClick
        tbLog.AppendText("EditorDoubleClick ")
    End Sub

    Private Sub shpEditor_FocusChanged(ByVal sender As Object) Handles Editor1.FocusChanged
        tbLog.AppendText("FocusChanged ")
    End Sub

    Private Sub shpEditor_DragChanged(ByVal sender As Object) Handles Editor1.DragChanged
        tbLog.AppendText("DragChanged ")
    End Sub
End Class
